package com.example.service.impl;

import com.example.pojo.chineseTripPojo;
import com.example.service.chineseTripService;
import com.example.mapper.chineseTripMapp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class chineseTripImpl implements chineseTripService {

    @Autowired
    private chineseTripMapp chineseTripMapp;

    @Override
    public List<chineseTripPojo> queryAll() {
        return chineseTripMapp.queryAll();
    }

    @Override
    public void insertOne(chineseTripPojo chineseTripPojo) {
        chineseTripPojo.setCreate_time(LocalDateTime.now());
        chineseTripPojo.setUpdate_time(LocalDateTime.now());
        chineseTripMapp.insertOne(chineseTripPojo);
    }

    @Override
    public void editChineseTrip(chineseTripPojo chineseTripPojo) {
        chineseTripPojo.setUpdate_time(LocalDateTime.now());
        chineseTripMapp.updateChineseTrip(chineseTripPojo);
    }
}
